﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
<link href="../tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="../tablecloth/tablecloth.js"></script>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<?php	

	include("../inc/joomlaInt_admin.php");
	include("../inc/inc_configuration.php");
	
if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{
	
	$q="SELECT gid FROM $tbl_users WHERE id=$jUser";
					$qe=mysql_query($q);
					$qeo=mysql_fetch_object($qe);
					
					$gid=$qeo->gid;
					
					if ($gid!=$admingroup)
					{
						echo "Du bist kein Admin!";
						break;
					}
					
	$liga=$_GET["liga"];
	
	$_SESSION["liga"]=$liga;
	
	$season=$_SESSION["season"];
	
	
	$q = "	SELECT
				*
			FROM
				$tbl_lg
			WHERE
				leagueId=$liga
			ORDER BY groupName ASC";
			
	$qe = mysql_query($q);
	
	$qec= mysql_num_rows($qe);

		echo"<table>
					<tr>
						<th>id</th>
						<th>Name</th>
						<th>Knockout</th>
						<th></th>
					</tr>";		
		
		if ($qec<1)
		{
			echo "<tr><td>Noch</td><td>keine</td><td>Gruppe</td><td>angelegt</td></tr>";
		}
			
			
		while ($gq=mysql_fetch_object($qe))
		{
			$id=$gq->id;
			$name=$gq->groupName;
			$kon=$gq->knockout;
			
			if ($kon==0) { $ko="Nein";} else {
			if ($kon==1) { $ko="Ja";}}
			
			echo "	<tr>
						<td>$id</td>
						<td><a href='gruppe.php?gruppe=",$id,"'>$name</a></td>
						<td>$ko</td>	
						<td><a href='gruppe_entfernen.php?gruppe=",$id,"&liga=",$liga,"' class='minibutton entfernen'></a></td>
					</tr>";
		}
		echo"<tr><th colspan='4'></th></tr>";
		
			
			echo "<form action='gruppe_hinzufuegen.php' method='post'>";
			
				
				echo '	
							<tr>
								<td colspan="2">Gruppe hinzufügen:</td>
								<td colspan="2"><select name="knockout" Size="1">
										<option value="0">Gruppe</option>
										<option value="1">K.O.</option>
									</select></td>
							</tr>
							<tr><td colspan="2"><input hidden type="text" size="17" name="liga" value="',$liga,'"></td>
								<td colspan="2"><input type="text" size="17" name="name"></td>
							</tr>
							<tr><td colspan="4"><input type="submit" class="button anlegen" value="Hinzufügen"></td></tr>
							<tr><th colspan="4"></th></tr>
						
					</form></table> ';
					
				echo "<br><br><a href='liga_verwaltung.php?season=$season' class='button zurueck'>Zurück</a>";
				
				
				
				
				
		//echo "</div>";
				
		
		
	
	

}

?>

</body>
</html>